package com.jf.cloud.live.response;

import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * 微信响应参数
 */
public class WxServerResponse<T> implements Serializable {

    private int errcode;

    private Integer total;

    private String msg;

    @SerializedName("list")
    private List<LiveUserRespInfo> list;

    private T roomInfo;

    private Long roomId;

    public boolean isSuccess(){
        return Objects.equals(ResponseCode.WX_SUCCESS, this.errcode);
    }

    public static WxServerResponse fromJson(String json) {
        return WxMaGsonBuilder.create().fromJson(json, WxServerResponse.class);
    }

    public int getErrcode() {
        return errcode;
    }

    public void setErrcode(int errcode) {
        this.errcode = errcode;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<LiveUserRespInfo> getList() {
        return list;
    }

    public void setList(List<LiveUserRespInfo> list) {
        this.list = list;
    }

    public T getRoomInfo() {
        return roomInfo;
    }

    public void setRoomInfo(T roomInfo) {
        this.roomInfo = roomInfo;
    }

    public Long getRoomId() {
        return roomId;
    }

    public void setRoomId(Long roomId) {
        this.roomId = roomId;
    }
}
